package com.aimee.mvc.model;

import com.aimee.mvc.bean.Account;
import com.aimee.mvc.callback.ResultCallBack;

import java.util.Random;

/**
 * MVC的Model层，用来进行数据处理
 */
public class MVCModel {
    public void getAccountData(String accountName, ResultCallBack resultCallBack) {
        Random random = new Random();
        boolean isSuccess = random.nextBoolean();
        if (isSuccess) {
            Account account = new Account();
            account.setName(accountName);
            account.setLevel(100);
            resultCallBack.onSuccess(account);
        } else {
            resultCallBack.onFail();
        }
    }
}
